package main

import (
	"fmt"
	"math/rand"
	"time"
)

func producer(ch chan<- int) {
	for {
		ch <- rand.Int()
		time.Sleep(time.Second * 2)
	}

}

func consumer(ch <-chan int) {
	for num := range ch {
		fmt.Println("consumer =", num)
	}
}

func main() {
	ch := make(chan int)

	go producer(ch)

	consumer(ch)
}
